﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace IBll
{
    public interface IBaseBll<T> where T : class,new()
    {
        #region 增加
        T Add(T entity);
        #endregion

        #region 删除
        bool Delete(T entity);
        #endregion

        #region 修改
        bool Update(T entity);
        #endregion

        #region 一般查询
        /// <summary>
        /// 
        /// </summary>
        /// <param name="whereLambda"></param>
        /// <returns></returns>
        IQueryable<T> GetEntities(Expression<Func<T, bool>> whereLambda);
        #endregion

        #region 分页查询
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="S">排序的属性的类型</typeparam>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="total">总数据数（符合条件的）</param>
        /// <param name="whereLambda"></param>
        /// <param name="orderbyLambda"></param>
        /// <param name="isAsc"></param>
        /// <returns></returns>
        IQueryable<T> GetEntitiesByPage<S>(int pageSize, int pageIndex, out int total, Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> orderbyLambda, bool isAsc);
        #endregion
    }
}
